import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import mqtt from './components/MqClient.js'

import './assets/css/bootstrap/css/bootstrap.min.css'
import './assets/css/font-awesome-4.7.0/css/font-awesome.css'  
import './assets/css/common/global.css'

import axios from 'axios'

//axios.baseUrl = "http://wss.hhdata.cn:20038/common/mysqldb/query";
Vue.prototype.$axios = axios; 
Vue.prototype.$query = function ( key , ps ){
  return new Promise( ( success , faild)=>{
    var url =  "https://wss.hhdata.cn:20038/common/mysqldb/query";
    axios.post(
      url ,
      {
        appId:"hwClound" ,
        key: key ,
        psJson:JSON.stringify(ps)
      }
    ).then( res=>{
      if( res.data && res.data.data ){
        try{
          success(res.data.data.result);
        }
        catch(err){
          console.log(err);
        }
      }
    }).catch(_=>{
      success(null)
    })
  })
}
Vue.prototype.$mqtt = new mqtt.TMqClient();
Vue.config.productionTip = false 

new Vue({
  axios ,
  router,
  store,
  render: h => h(App)
}).$mount('#app')
